import 'package:flutter/material.dart';

typedef ActionCallback = void Function(dynamic data);

/// [MyAppBarBase] is responsible for building customized AppBar.
///
/// It typically used in the [main_view.dart] which needs to display different [Widget] with its own [AppBar].
///
/// This can be used in the view with [BottomNavigationBar]. You can define different [AppBar] for different
/// view since the [BottomNavigationBarItem] or [BottomAppBar] will decide which view will be displayed at a time.
///
/// We are not using a [StatelessWidget] type because the [appBar] of the [Scaffold] does not take the argument with type [Widget].
/// [StatelessWidget] type returns [Widget] via [build] method which cannot be assigned to [appBar].
///
abstract class MyAppBarBase {
  MyAppBarBase({this.actionCallback});

  final ActionCallback? actionCallback;

  /// Gets the customized [AppBar].
  ///
  /// [context] is for the usage of [Navigator.of(context)], [Theme.of(context)], [Scaffold.of(context)] and so on.
  /// This might be a time consuming task. That's why make this as a method over a property.
  AppBar? getAppBar(BuildContext context);
}
